package com.letere.controller;

import com.letere.bean.Result;
import com.letere.util.JwtUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author letere
 * @create 2021-02-05 12:23
 */
@RestController
public class LoginController {

    @ApiOperation("判断是否已经登录")
    @ApiImplicitParam(name = "token", value = "令牌",required = true)
    @GetMapping("/isLogin")
    public Result isLogin(String token) {
        try {
            JwtUtil.verify(token);
        } catch (Exception e) {
            return Result.failure("验证失败！");
        }
        return Result.success("验证成功！");
    }
}
